#define _CRT_SECURE_NO_WARNINGS 1
int camper(const int* p1, const int* p2)
{
    return *p1 - *p2;
}


int findDuplicate(int* nums, int numsSize) {
    qsort(nums, numsSize, sizeof(int), camper);
    for (int i = 0; i < numsSize; i++)
    {
        if (nums[i] == nums[i + 1])
            return nums[i];
    }
    return 0;
}